package com.justgame.project.service.system.feign;

import com.justgame.project.service.api.dto.SysFileInfoDTO;
import com.justgame.project.service.api.feign.ISysFileInfoClient;
import com.justgame.project.service.system.service.SysFileInfoService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * SysFileInfo 微服务接口实现
 * @author ZhouWeiBo
 * @create 2022/4/13
 */
@RestController
@AllArgsConstructor
public class SysFileInfoClient implements ISysFileInfoClient {
    private final SysFileInfoService fileInfoService;

    @Override
    @DeleteMapping(REAL_DEAL_FILE)
    public Boolean deleteFile(SysFileInfoDTO dto) {
        return fileInfoService.realDelete(dto) > 0;
    }

    @Override
    public Boolean deleteFiles(List<String> paths) {
        try {
            fileInfoService.deleteFiles(paths);
            return true;
        }catch (Exception e){
            return false;
        }
    }
}
